package com.x.Part5_接口;

/**
 * ClassName: InterfaceTest
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.03.05 14:14
 */
public class InterfaceTest {
    public static void main(String[] args) {

        Bullet b1 = new Bullet();

        b1.attack();
        b1.fly();

        //多态性
        Flyable b2 = new Bullet();
        b2.fly();

        Aggressiveness b3 = new Bullet();
        b3.attack();
    }
}

interface Flyable{

    //全局常量
    public static final int MIN_SPEED = 0;

    //public static final可以省略，省略后也是public static final的全局常量
    int MAX_SPEED = 0;


    //已经省略了public abstract
    void fly();

}

interface Aggressiveness{

    int MIN_ATTACK = 0;

    //public abstract可省略
    public abstract void attack();

}


